package com.itheima.patterns.structuralpattern.Flyweight;

public class Client {
    public static void main(String[] args) {
        //获取 I 图形对象
        AbstractBox box1 = BoxFactory.getInstance().getShape("I");
        box1.display("灰色");

        //获取 L 图形对象
        AbstractBox box2 = BoxFactory.getInstance().getShape("L");
        box2.display("红色");

        //获取 O 图形对象
        AbstractBox box3 = BoxFactory.getInstance().getShape("O");
        box3.display("黑色");

        //获取 O 图形对象
        AbstractBox box4 = BoxFactory.getInstance().getShape("O");
        box4.display("蓝色");

        System.out.println("两次获取到的 O 图形对象是否为同一个对象？" + (box3 == box4));
    }
}